package com.jeecg.p3.system.poster.service;

import com.jeecg.p3.system.poster.dao.GradesNumDao;
import com.jeecg.p3.system.poster.entity.AdvisorCoupon;
import com.jeecg.p3.system.poster.entity.GradesNum;
import com.jeecg.p3.system.poster.entity.PosterManager;
import com.jeecg.p3.system.util.UuidUtils;
import org.jeecgframework.p3.core.utils.common.PageQuery;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 * @ClassName: GradesNumService
 * @Description: TODO 交易统计处理层
 * @author: zhangxiao
 * @date: 2020年11月30日 下午7:29:38
 */
@Service
public class GradesNumService {
    @Resource
    private GradesNumDao dao;

    /**
     * 根据参数查询支付统计结果
     * @param gradesNum
     * @return
     */
    public List<GradesNum> findByParam(GradesNum gradesNum) {
        if(gradesNum == null) {
            gradesNum = new GradesNum();
        }
        return dao.findByParam(gradesNum);
    }

    /**
     * 新增支付成功统计
     * @param gradesNum
     */
    public void doAdd(GradesNum gradesNum) {
        gradesNum.setStatus("1");
        gradesNum.setId(UuidUtils.getId());
        dao.insert(gradesNum);
    }

    /**
     * 查询支付数量根据传参
     * @param gradesNum
     * @return
     */
    public Integer count(GradesNum gradesNum) {
        PageQuery<GradesNum> pageQuery = new PageQuery<>();
        pageQuery.setQuery(gradesNum);
        return dao.count(pageQuery);
    }
}
